package service

import (
	"github.com/gofiber/fiber/v2"
	"guns-excel/internal/app/model"
	"guns-excel/internal/app/repository"
	"guns-excel/internal/pkg/database"
	"guns-excel/internal/pkg/util"
	"time"
)

func AddModelExcel(ctx *fiber.Ctx, modelExcel *model.ModelExcel) error {
	modelExcel.Id = util.GetId()
	nowDate := time.Now()
	modelExcel.CreatedOn = &nowDate
	return repository.AddModelExcel(ctx, modelExcel, database.MysqlDB)
}

func GetModelExcelByModelId(ctx *fiber.Ctx, modelId string) ([]*model.ModelExcel, error) {
	return repository.GetModelExcelByModelId(ctx, modelId, database.MysqlDB)
}
